﻿<UserControl x:Class="eisiWare.NumericUpDown" x:Name="ucNumericUpDown"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="23" d:DesignWidth="200" Height="23" Width="150" xmlns:my="clr-namespace:eisiWare" DataContext="{Binding RelativeSource={RelativeSource Self}}" Loaded="ucNumericUpDown_Loaded">
    <UserControl.Resources>
        <my:BtnHeightConverter x:Key="BtnHeightConverter" />
        <my:DecimationConverter x:Key="DecimationConverter" />
        <my:BtnShowConverter x:Key="BtnShowConverter" />
        <my:BtnShowGridConverter x:Key="BtnShowGridConverter" />
        <Style x:Key="disableImageButton" TargetType="{x:Type Image}">
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="true">
                    <Setter Property="Opacity" Value="1" />
                </Trigger>
                <Trigger Property="IsEnabled" Value="false">
                    <Setter Property="Opacity" Value="0.25" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="1*" />
            <ColumnDefinition Width="23" />
        </Grid.ColumnDefinitions>
        <TextBox HorizontalAlignment="Stretch" Name="tbValue" Height="{Binding ElementName=ucNumericUpDown, Path=Height}" Grid.ColumnSpan="{Binding Path=ShowButtons, Converter={StaticResource BtnShowGridConverter}}">
        </TextBox>
        <StackPanel Orientation="Vertical" Grid.Column="1" Visibility="{Binding Path=ShowButtons, Converter={StaticResource BtnShowConverter}}">
            <Button Height="{Binding ElementName=tbValue, Path=Height, Converter={StaticResource BtnHeightConverter}}" Name="btnUp" Width="23" Click="btnUp_Click">
                <Image Style="{StaticResource disableImageButton}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Source="/NumericUpDown;component/Images/arrow-up.png" />
            </Button>
            <Button Height="{Binding ElementName=tbValue, Path=Height, Converter={StaticResource BtnHeightConverter}}" Name="btnDown"  Width="23" Click="btnDown_Click">
                <Image Style="{StaticResource disableImageButton}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Source="/NumericUpDown;component/Images/arrow-down.png" />
            </Button>
        </StackPanel>
    </Grid>
</UserControl>

<!--
	<c> Copyright eisiWare - Tobias Eiseler 2011

	This file is part of NumericUpDown.

    NumericUpDown is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    NumericUpDown is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with NumericUpDown.  If not, see <http://www.gnu.org/licenses/>.

-->
    